package controller;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Auther:ws@itany.com
 * Date:20-9-16 下午3:45
 * Version:1.0
 * Description:
 */

public class HelloController implements Controller {

    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        ModelAndView mav = new ModelAndView();

        // 页面跳转,其值是一个字符串,字符串有三种格式
        // 1.直接写字符串
        // 2.redirect:命令
        // 3.forward:命令
        mav.setViewName("hello");
        mav.addObject("msg","Hello Word");
        return mav;
    }
}
